<template>
  <div>
    <p>count:{{ count }}</p>
    <Child @addCount="addCount"/>
  </div>
  
</template>

<script>
import Child from './components/Child.vue'
export default {
name:"App",
components:{
  Child
},
data(){
  return{
    count:0
  }
},
methods:{
   //自定义事件函数的参数就是 在组件内部$emit调用自定义事件时传递的参数
  addCount(c){
    
        this.count += c
    }
}

}
</script>

<style>

</style>